//
// Copyright (c) 2024 BPer
//
#ifndef INCLUDE_BPERRTC_BPERPEERCONNECTION2_H_
#define INCLUDE_BPERRTC_BPERPEERCONNECTION2_H_
#include <bperrtc/BPerPeerConnection.h>
class BPerPeerConnection2 {
public:
	BPerPeerConnection2(BPerAVInfo* avinfo,BPerStreamConfig* streamConfig);
	virtual ~BPerPeerConnection2();
	BPerStreamConfig* streamConfig;
public:
	void init();

    int32_t addAudioTrack(BPerAudioCodec codec);
    int32_t addVideoTrack(BPerVideoCodec codec);

    int32_t addTransceiver(BPerRtcDirection direction);

	int32_t createOffer( char **psdp);
	int32_t createAnswer(char* answer);
	int32_t createHttpAnswer(char* answer);
	int32_t createDataChannel();
	int32_t setRemoteDescription(char* sdp);
	int32_t connectSfuServer();//srs zlm
	int32_t connectWhipServer(char* url);

	int32_t close();

	int32_t isAlive();
	int32_t isConnected();

	int32_t on_audio(BPerFrame* audioFrame);
	int32_t on_video(BPerFrame* videoFrame);
	int32_t on_message(BPerFrame* msgFrame);

	int32_t sendRtcMessage( BPerRtcMessageType mess);

private:
	BPerPeerConnection m_conn;
};

#endif /* INCLUDE_BPERRTC_BPERPEERCONNECTION2_H_ */
